class User {
  final int id;
  final String username;
  final String password;
  final String nickname;
  final String avatar;
  final String sign;

  User({
    required this.id,
    required this.username,
    required this.password,
    required this.nickname,
    required this.avatar,
    required this.sign,
  });

  // 从JSON转换为User对象
  factory User.fromJson(Map<String, dynamic> json) {
    return User(
      id: json['id'],
      username: json['username'],
      password: json['password'],
      nickname: json['nickname'],
      avatar: json['avatar'],
      sign: json['sign'],
    );
  }

  // 将User对象转换为JSON
  Map<String, dynamic> toJson() {
    return {
      'id': id,
      'username': username,
      'password': password,
      'nickname': nickname,
      'avatar': avatar,
      'sign': sign,
    };
  }
} 